package com.tank.demo.utils;

import com.tank.demo.abstractFactory.BaseGameObject;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.awt.*;


public class RectangleUtil {
    public static boolean intersects(BaseGameObject o1, BaseGameObject o2) {
        Rectangle rect1 = new Rectangle(o1.x, o1.y, o1.width, o1.height);
        Rectangle rect2 = new Rectangle(o2.x, o2.y, o2.width, o2.height);
        return rect1.intersects(rect2);
    }
}
